package actions;

import gui.Frame;

import information.User;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

/**
 * An action used to blackball a user. The action is associated with
 * a specific user and when is sent an action event if the user is a 
 * volunteer and not already blackballed, it will change their blackball status. 
 * 
 * @author Christian
 *
 */
@SuppressWarnings("serial")
public class BlackballAction extends AbstractAction {

	private final Frame myFrame;
	
	private final User myVolunteer;
	
	public BlackballAction(final Frame theFrame, final User theVolunteer) {
		super("Blackball");
		myFrame = theFrame;
		myVolunteer = theVolunteer;
	}
	
	/**
	 * Sets the previous action for the last screen displayed, blackballs the user, and displays a success
	 * screen letting the user know the action was successful. 
	 */
	@Override
	public void actionPerformed(final ActionEvent theEvent) {
		myFrame.setPreviousAction(new BlackballVolunteerAction(myFrame));
		myVolunteer.setBlackballed();
		myFrame.displaySuccess("The Volunteer has been blackballed. Thank you!");
		
	}


}